package com.gold.controller;

import com.alibaba.fastjson.JSONObject;
import com.gold.common.DateUtils;
import com.gold.common.JsonUtils;
import com.gold.common.StringUtils;
import com.gold.entity.CardInfo;
import com.gold.entity.User;
import com.gold.service.CardInfoService;
import com.gold.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.stereotype.Controller;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

/**
 * @author XiaoHao
 * @date 2022-05-06 11:54
 */
@Controller
public class LoginController {
    @Autowired
    private UserService userService;



    /**
     * 注册
     * @param user
     * @return
     */
    @RequestMapping(value = "/register",method = RequestMethod.POST)
    @ResponseBody
    public String register(@RequestBody JSONObject user){
        return  userService.insertVerify(user);
    }

    /**
     * 再激活
     * @param parm
     * @return
     */
    @RequestMapping(value = "/active",method = RequestMethod.POST)
    @ResponseBody
    public String active(@RequestBody JSONObject parm){
        return userService.activeUser(parm);
    }
}
